//package com.gtx.admin.controller;
//
//import com.gtx.common.pojo.Admin;
//import com.gtx.common.pojo.AdminLogin;
//import com.gtx.common.pojo.RespBean;
//import com.gtx.common.service.IAdminService;
//import io.swagger.annotations.Api;
//import io.swagger.annotations.ApiOperation;
//import org.mybatis.spring.annotation.MapperScan;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.web.bind.annotation.GetMapping;
//import org.springframework.web.bind.annotation.PostMapping;
//import org.springframework.web.bind.annotation.RequestMapping;
//import org.springframework.web.bind.annotation.RestController;
//
//import javax.servlet.http.HttpServletRequest;
//import java.security.Principal;
//
///**
// * 登录
// *
// * @author songyurui
// * @since 1.0.0
// */
//@RestController
//@Api(tags = "登录")
//@RequestMapping("/gtx")
//@MapperScan("com.gtx.common.mapper")
//public class LoginController {
//
//    @Autowired
//    private IAdminService adminService;
//
//    @ApiOperation(value = "登录之后返回token")
//    @PostMapping("/login")
//    public RespBean login(AdminLogin adminLogin, HttpServletRequest request) {
//        return adminService.login(adminLogin.getUsername(), adminLogin.getPassword(), request);
//    }
//
//    @ApiOperation(value = "获取当前登录用户信息")
//    @GetMapping("/admin/info")
//    public Admin getAdminInfo(Principal principal) {
//
//        if (null == principal) {
//            return null;
//        }
//
//        String username = principal.getName();
//        Admin admin = adminService.getAdminByUserName(username);
//        admin.setPassword(null);
//        return admin;
//    }
//
//
//    @ApiOperation(value = "退出登录")
//    @PostMapping("/logout")
//    public RespBean logout() {
//        return RespBean.success("注销成功！");
//    }
//
//}
//
